package day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        int score =0;
        for (int i = 1; i <=10; i++) {
            int a=(int)(Math.random()*100+1);
            int b=(int)(Math.random()*100+1);
            int result=a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧");
            int answer = scan.nextInt();
            if (answer==result){
                System.out.println("答对了");
                score+=10;
            }else {
                System.out.println("打错了");
            }

        }
        System.out.println("总分为："+score);













       /* for (int i = 1; i <=10 ; i++) {
            int num1=(int)(Math.random()*100+1);
            int num2=(int)(Math.random()*100+1);
            System.out.println(num1+"+"+num2+"=");
            int N=scan.nextInt();
            if (N==num1+num2){
                score+=10;
                System.out.println("答对了");
            }else {
                System.out.println("答错了");
            }

        }
        System.out.println("总分为:"+score);

        */


    }
}
